package com.rongji.dfish.framework.singletonimpl;

import com.rongji.dfish.base.util.XMLUtil;
import com.rongji.dfish.framework.SystemConfigHolder;
import com.rongji.dfish.framework.SystemData;

public class DefaultSystemConfig implements SystemConfigHolder{
	private String configFile;
	private XMLUtil xmltool;
	public String getProperty(String name) {
		return xmltool.getProperty(name);
	}

	public void reset() {
		@SuppressWarnings("deprecation")
        String configPath=SystemData.getInstance().getServletInfo().getServletRealPath()+"WEB-INF/config/"+configFile;
		System.out.println("load file : "+configPath);
		xmltool=new XMLUtil(configPath, 256);
	}

	public void setProperty(String key, String value) {
		xmltool.setProperty(key, value);
	}

	public String getConfigFile() {
		return configFile;
	}

	public void setConfigFile(String configFile) {
		this.configFile = configFile;
		reset();
	}
	

}
